import request from '@/utils/request'

export function create(data) {
  return request({
    url: '/folder/create',
    method: 'post',
    data
  })
}

export function deleteFile(id) {
  return request({
    url: '/folder/delete',
    method: 'get',
    params: { id }
  })
}

export function download(id) {
  return request({
    url: '/resource/download',
    method: 'get',
    params: { id }
  })
}

export function upload(data) {
  return request({
    url: '/resource/upload',
    method: 'post',
    config: {
      headers: { 'Content-Type': 'multipart/form-data' }
    },
    data: data
  })
}

export function getParentFolder(data) {
  return request({
    url: '/folder/getParentFolder',
    method: 'post',
    data: data
  })
}

export function getById(id) {
  return request({
    url: '/folder/getById',
    method: 'post',
    params: { id }
  })
}

export function rename(data) {
  return request({
    url: '/folder/rename',
    method: 'post',
    data: data
  })
}

export function query(data) {
  return request({
    url: '/folder/query',
    method: 'post',
    data: data
  })
}
